package com.ittest.config;


import com.alibaba.druid.pool.DruidDataSource;
import com.ittest.bean.Cat;
import com.ittest.bean.Mouse;
import com.ittest.bean.MyImportSelector;
import org.springframework.boot.autoconfigure.condition.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Import;

//@Import(MyImportSelector.class)
//@Import(Mouse.class)
@ComponentScan("com.ittest.bean")
public class SpringConfig {
    /**
    @Bean
    //@ConditionalOnClass(name ="com.ittest.bean.Mouse")
    //@ConditionalOnMissingClass("com.ittest.bean.Mouse")
    @ConditionalOnBean(name = "jerry")
    //@ConditionalOnMissingClass("com.ittest.bean.Dog")
    //@ConditionalOnNotWebApplication
    @ConditionalOnWebApplication
    public Cat tom(){
        return new Cat();
    }
    **/


    @Bean
    @ConditionalOnClass(name = "com.mysql.jdbc.Driver")
    public DruidDataSource dataSource(){
        return new DruidDataSource();
    }

}
